package com.example.demo01.Socket.Codec.encode;

import com.example.demo01.VO.IPacketInstruction;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import lombok.extern.slf4j.Slf4j;


@Slf4j
public class MyMessageEncoder1 extends MessageToByteEncoder<IPacketInstruction> {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, IPacketInstruction packetInstruction, ByteBuf byteBuf) throws Exception {

        log.info("encoding message.");
        byteBuf.writeBytes(packetInstruction.getBytes());

    }
}
